import { defineStore } from 'pinia';
import { Token } from '@/types/common/setting.ts';

export const auth = defineStore('auth', {
  state: (): Token => {
    return {
      token: '',
    };
  },
  getters: {
    token: (state): Token => {
      return {
        token: state.token,
      };
    },
  },
  actions: {
    updateToken(token: string) {
      this.$state.token = token;
    },
  },
  persist: {
    storage: window.localStorage,
  },
});
